<?php 
header("Content-type: text/xml");

require_once 'settings.php';
// $con = mysql_connect('localhost', 'root', 'super');
// if (!$con)
//   {
//   die('Could not connect: ' . mysql_error());
//   }

// mysql_select_db("db_tursib", $con);
 

$sql=" 
select id_bus, bus_name from t_stations as a 
    join t_station_bus as b
    on a.id_station = b.t_stations_id_station 
    join t_busses as c
    on b.t_busses_id_bus = c.id_bus
  where id_station = '$_GET[id_station]'";


$result = mysql_query($sql);

//Build Result String
$data = "<?xml version='1.0' encoding='UTF-8'?><xml>" ;
 

// Insert a new row in the table for each person returned
while($row = mysql_fetch_array($result)){
	$data .= "<item>";
	$data .= "<id>$row[id_bus]</id>"; 
	$data .= "<bus>$row[bus_name]</bus>"; 
	$data .= "</item>";

} 
$data .="</xml>";
echo $data;  

mysql_close($con);
?>